Fixing integ tests (ReplicationEngine now constructs lightweight copies of Index / Delete operations with Origin.REPLICA before passing them to the non-primary planning path)#1647
Merged
Conversation
ankitkala
reviewed
Mar 24, 2026
Member
ankitkala
left a comment
There was a problem hiding this comment.
Can you fix the diff. right now the ordering of methods is messed up. so identifying diff becomes difficult.
Signed-off-by: Mohit Kumar <mohitamg@amazon.com>
This reverts commit 0e4b126. Signed-off-by: Mohit Kumar <mohitamg@amazon.com>
Signed-off-by: Mohit Kumar <mohitamg@amazon.com>
cwperks
reviewed
Mar 24, 2026
cwperks
approved these changes
Mar 24, 2026
3 tasks
66 tasks
peterzhuamazon
approved these changes
Mar 25, 2026
tanyabti
pushed a commit
to tanyabti/cross-cluster-replication
that referenced
this pull request
Apr 9, 2026
…es of Index / Delete operations with Origin.REPLICA before passing them to the non-primary planning path) (opensearch-project#1647) * Stab at Fixing integ tests Signed-off-by: Mohit Kumar <mohitamg@amazon.com> * Revert "Stab at Fixing integ tests" This reverts commit 0e4b126. Signed-off-by: Mohit Kumar <mohitamg@amazon.com> * Stab at Fixing integ tests Signed-off-by: Mohit Kumar <mohitamg@amazon.com> --------- Signed-off-by: Mohit Kumar <mohitamg@amazon.com> Co-authored-by: Mohit Kumar <mohitamg@amazon.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
OpenSearch #20585 (commit 59be6ae) refactored InternalEngine by extracting IndexingStrategy and DeletionStrategy from inner static classes into top-level classes, and introduced IndexingStrategyPlanner / DeletionStrategyPlanner to encapsulate planning logic. This broke CCR's ReplicationEngine in two ways:
Compilation failure: IndexingStrategy and DeletionStrategy are no longer inner classes of InternalEngine — they need explicit imports from org.opensearch.index.engine.
Runtime assertion failures: The new planner classes have their own assertNonPrimaryOrigin check (via the OperationStrategyPlanner interface default method), which is separate from InternalEngine.assertNonPrimaryOrigin. CCR's ReplicationEngine overrode the engine-level method to return true, but that override is never invoked by the planner. Since CCR replays operations with Origin.PRIMARY (they arrive via TransportReplayChangesAction.performOnPrimary) but routes them through planIndexingAsNonPrimary / planDeletionAsNonPrimary, the planner's assertion fires.
Fix
ReplicationEngine now constructs lightweight copies of Index / Delete operations with Origin.REPLICA before passing them to the non-primary planning path. This satisfies the assertions at both the engine level and the planner level. The copies also use null for versionType and unassigned values for ifSeqNo / ifPrimaryTerm, as the Engine$Index and Engine$Delete constructors enforce these constraints for non-PRIMARY origins. This is safe because the non-primary planning path resolves conflicts using sequence numbers, not version types or conditional (optimistic concurrency) parameters.
The actual indexing/deletion still operates on the original operation objects — only the strategy planning step sees the replica copies.
Related Issues
Resolves #1646
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.